/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * @author Juanan
 * 
 */
@Entity
@Table(name = "acc_access")
@NamedQueries(
{
    @NamedQuery(name = "AccAccess.findAll", query = "SELECT a FROM AccAccess a")
})
public class AccAccess implements Serializable
{
    private static final long serialVersionUID = 1L;
    public static final String ACC_ID = "ACC_ID";
    public static final String GRP_ID = "GRP_ID";
    public static final String FUN_ID = "FUN_ID";
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ACC_ID")
    private Integer accId;
    @JoinColumn(name = "GRP_ID", referencedColumnName = "GRP_ID")
    @ManyToOne(optional = false)
    private GrpGroup grpId;
    @JoinColumn(name = "FUN_ID", referencedColumnName = "FUN_ID")
    @ManyToOne(optional = false)
    private FunFunction funId;

    public AccAccess()
    {
    }

    public AccAccess(Integer accId)
    {
        this.accId = accId;
    }

    public Integer getAccId()
    {
        return accId;
    }

    public void setAccId(Integer accId)
    {
        this.accId = accId;
    }

    public GrpGroup getGrpId()
    {
        return grpId;
    }

    public void setGrpId(GrpGroup grpId)
    {
        this.grpId = grpId;
    }

    public FunFunction getFunId()
    {
        return funId;
    }

    public void setFunId(FunFunction funId)
    {
        this.funId = funId;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (accId != null ? accId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AccAccess))
        {
            return false;
        }
        AccAccess other = (AccAccess) object;
        if ((this.accId == null && other.accId != null) || (this.accId != null && !this.accId.equals(other.accId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "entities.AccAccess[ accId=" + accId + " ]";
    }
    
}
